/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package assisisw.smartcal.weathersubsystem;

import java.util.Calendar;
import java.util.Date;
import javax.ejb.EJB;
import javax.ejb.Stateless;

/**
 *
 * @author Francesco
 */
@Stateless
public class RealTimeDataProvider implements IRealTimeDataProvider 
{

    // Instance Fields
    
    /***/
    @EJB ()
    private IWeatherCache weatherCache ;
    
    // Instance Methods
    
    /***/
    public RealTimeDataProvider () {}
 
    /**
     * AS THE SUPER'S ONE.
     */
    @Override
    public WeatherData extract ( String city ) 
    {
        WeatherData res ;
        res = weatherCache.getEntry( city , new Date () , Calendar.getInstance ().get ( Calendar.HOUR ) ) ;
        return res ;
    }
    
}
